#pragma once
#include "generator.hpp"
#include <vector>
#include <set>

class Splitter
{
public:
    Splitter(Generator<float> &, int count = 2);
    Generator<float> &operator[](int);
private:
    class Out: public Generator<float>
    {
    public:
        Out(Splitter * = 0, int channel = 0);
        float operator()();
    private:
        Splitter *parent_;
        int channel_;
    };
    float operator()(int channel);

    Generator<float> &in_;
    std::vector<Out> out_;
    std::set<int> channels_;
    float value_;
};
